//
//  BackgroundAndoverlayBootcamp.swift
//  SwiftUiExercise
//
//  Created by 徐鹏 on 2023/6/24.
//

import SwiftUI

struct BackgroundAndoverlayBootcamp_10: View {
    var body: some View {
        VStack{
            
            Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
                .background(
                    //1.Color.red
                    //2.                LinearGradient(
                    //                    gradient: Gradient(colors: [Color.red,Color.blue]),
                    //                    startPoint: .leading,
                    //                    endPoint: .trailing
                    //                )
                    
                    Circle()
                        .fill(LinearGradient(gradient: Gradient(colors: [Color.yellow,Color.blue]), startPoint: .leading, endPoint: .trailing))
                        .frame(width: 100,height: 100,alignment: .center)
                    
                )
            
                .background(
                    Circle().fill(LinearGradient(gradient: Gradient(colors: [Color.red,Color.blue]), startPoint: .leading, endPoint: .trailing))
                        .frame(width: 120,height: 120,alignment: .center)
                )
            
            Circle()
                .fill(Color.pink)
                .frame(width: 100,height: 100,alignment: .center)
                .overlay(
                   Text("1")
                    .font(.largeTitle)
                    .foregroundColor(.white)
                )
                .background(
                    Circle()
                        .fill(Color.purple)
                        .frame(width: 110,height: 110)
                )
            
            Rectangle()
                .frame(width: 100,height: 100,alignment: .center)
                .overlay(
                    Rectangle()
                        .fill(Color.blue)
                        .frame(width: 50,height: 50,alignment: .center)
                ).background(
                )
        }
    }
}

struct BackgroundAndoverlayBootcamp_Previews: PreviewProvider {
    static var previews: some View {
        BackgroundAndoverlayBootcamp_10()
    }
}
